﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Commons.Data;
using Commons.Entity;
using VCommons;
using System.Reflection;
using Common.Background.Data;
namespace Common.Background.Service
{
    /// <summary>
    /// 业务层抽象基类
    /// </summary>
    public abstract class ServiceBase
    {
        /// <summary>
        /// 通用消息
        /// </summary>
        protected VMessage VMessage { get; set; }
        private static object CreateObject(string AssemblyPath, string classNamespace)
        {
            object objType = DataCache.GetCache(classNamespace);
            if (objType == null)
            {
                try
                {
                    objType = Assembly.Load(AssemblyPath).CreateInstance(classNamespace);
                    DataCache.SetCache(classNamespace, objType);// 写入缓存

                }
                catch//(System.Exception ex)
                {
                    //string str=ex.Message;// 记录错误日志
                }
            }
            return objType;
        }



        #region 对DATA层的Repository对象的引用
        /// <summary>
        /// WebManageRoles操作对象
        /// </summary>
        protected IWebManageRolesRepository iWebManageRolesRepository
        {
            get { return new WebManageRolesRepository(); }
        }

        /// <summary>
        /// WebDepartments操作对象
        /// </summary>
        protected IWebDepartmentsRepository iWebDepartmentsRepository
        {
            get { return new WebDepartmentsRepository(); }
        }

        /// <summary>
        ///WebManageRole_WebManageMenus操作对象
        /// </summary>
        protected IWebManageRole_WebManageMenusRepository iWebManageRole_WebManageMenusRepository
        {
            get { return new WebManageRole_WebManageMenusRepository(); }
        }

        /// <summary>
        /// WebManageMenus操作对象
        /// </summary>
        protected IWebManageMenusRepository iWebManageMenusRepository
        {
            get
            { return new WebManageMenusRepository(); }
        }

        /// <summary>
        /// WebManageUser_Strategy操作对象
        /// </summary>
        protected IWebManageUser_StrategyRepository iWebManageUser_StrategyRepository
        {
            get { return new WebManageUser_StrategyRepository(); }
        }

        /// <summary>
        /// WebManageUser_WebManageRoles操作对象
        /// </summary>
        protected IWebManageUser_WebManageRolesRepository iWebManageUser_WebManageRolesRepository
        {
            get { return new WebManageUser_WebManageRolesRepository(); }
        }

        /// <summary>
        /// WebManageUsers操作对象
        /// </summary>
        protected IWebManageUsersRepository iWebManageUsersRepository
        {
            get { return new WebManageUsersRepository(); }
        }
        #endregion




    }
}
